"use strict";
cc._RF.push(module, '4b903Sz3dZIkb+6BP9RNSa8', 'TryUseView');
// scripts/TryUseView.js

"use strict";

var e = require;
var t = module;
var n = exports;
Object.defineProperty(n, "__esModule", {
  value: !0
});

var o = e("ViewBase"),
    i = e("DataMgr"),
    a = e("VideoHint"),
    r = cc._decorator,
    s = r.ccclass,
    c = r.property,
    l = function (e) {
  __extends(t, e);

  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.adBtnNode = null;
    return t;
  }

  n = t;

  t.prototype.enter = function (t) {
    e.prototype.enter.call(this, t);
    SDK.Mgr.Inst.event("ShowFishSkin");
    SDK.Base.Event.emit("PanelOpen");
    n.showCount++;
    SDK.Mgr.Inst.isAdOpen && (n.showCount % 2 == 0 ? this.adBtnNode.setSiblingIndex(0) : this.adBtnNode.setSiblingIndex(1));
  };

  t.prototype.adBtnClick = function () {
    var e = this,
        t = "FishSkin_Ad";
    SDK.Mgr.Inst.event(t + "Click");

    var n = function n(o) {
      if (o == SDK.Define.AdsCode.finish) {
        SDK.Mgr.Inst.event(t + "Success");
        i["default"].Instance.curSkinNum = 1;

        if (null != KillerController.Instance) {
          KillerController.Instance.freshSkin();
          SDK.ToastMgr.Inst.showToast("获得棒棒糖武器");
          e.closePanel();
        }
      } else if (o == SDK.Define.AdsCode.cancel) {
        SDK.Mgr.Inst.event(t + "Cancel");
        a["default"].Instance.openPanel(n);
      } else {
        SDK.ToastMgr.Inst.showToast("暂无广告，请稍后再试");
        SDK.Mgr.Inst.event(t + "NoAd");
      }
    };

    SDK.Mgr.Inst.showVideo(n);
  };

  t.prototype.closePanel = function () {
    e.prototype.exit.call(this);
    SDK.Base.Event.emit("PanelClose");
  };

  var n;
  t.showCount = 0;

  __decorate([c(cc.Node)], t.prototype, "adBtnNode", void 0);

  return n = __decorate([s], t);
}(o["default"]);

n["default"] = l;

cc._RF.pop();